package Classroom2;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Server {
    public static void main(String[] args) throws IOException {
        //创建一个线程池对象
        ExecutorService es = Executors.newFixedThreadPool(10);
        //服务端对象
        ServerSocket ss = new ServerSocket(12222);
        while (true) {
            //监听
            final  Socket s = ss.accept();
            ThreadSocket ts = new ThreadSocket(s);
            es.submit(ts);
        }
        //服务器不关闭
        //ss.close();
    }
}
